<template>
  <view class="content">
    <view style="height: 30rpx"></view>
    <view class="box">
      <view class="title">{{ noticeDetail.title }}</view>
      <view class="time">{{ getData(noticeDetail.create_time) }}</view>
      <view class="ggContent" v-html="html"> </view>
      <!-- <view class="right"
        ><image src="../../static/tabBar/gongao.png" alt=""
      /></view> -->
    </view>
  </view>
</template>

<script>
export default {
  name: "tab-1",
  data() {
    return {
      id: "",
      noticeDetail: {},
      html: "",
    };
  },
  onLoad(options) {
    this.id = options.id;
    this.getNoticeDetail();
  },
  methods: {
    async getNoticeDetail() {
      const data = await this.http.get("notice/detail", { id: this.id });
      this.noticeDetail = data.data;
      var regex0 = new RegExp("(i?)(<img)([^>]+>)", "gmi"); //正则匹配表达式
      this.html = data.data.content.replace(
        regex0,
        "$2 style='width: 100%;height: auto; display: block' $3"
      );
    },
  },
};
</script>
<style lang="scss" scoped>
.box {
  background-color: #ffffff;
  margin: 0 30rpx 0rpx;
  border-radius: 20rpx;
  padding: 20rpx;
}
.title {
  height: 40rpx;
  font-size: 32rpx;
  font-weight: 500;
  line-height: 40rpx;
  color: #000000;
  opacity: 1;
  margin-bottom: 20rpx;
}
// style="width: 100%"
.time {
  color: #999999;
  font-size: 24rpx;
  font-weight: 300;
  margin-bottom: 20rpx;
}
</style>